/* SQUIB - Scala's Quirky User Interface Builder 
    Copyright (C) 2008 Tim Dalton

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
*/

package tfd.scala.squib.demo.scenario;

import java.awt.{Component, Color, Point, Font, Dimension, Rectangle, BasicStroke}
import javax.swing.{JFrame}

import com.sun.scenario.scenegraph._
import com.sun.scenario.animation._

import tfd.scala.squib._
import tfd.scala.squib.scenario.scenegraph._
import tfd.scala.squib.scenario.scenegraph.Implicits._

object SceneGraphSimple extends Application {
    text.attributesDefault = attributes(
            'font -> new Font("Courier", Font.BOLD, 24),
            'mode -> SGAbstractShape.Mode.FILL,
            'fillPaint -> Color.BLUE
    )
    
    val frm = frame(
              'title->"SQUIB Scenegraph Demo",
              'visible -> true,
              'defaultCloseOperation -> JFrame.EXIT_ON_CLOSE,
              'size -> new Dimension(100,200),
              contents(
                     scenepanel("scene",
                         'scene -> group("root",
                                       group("sub",
                                           translate(50, 100, 
                                               rotate("square", 0.0,
                                                   shape(
                                                         'shape -> new Rectangle(-20,-20,40,40),
                                                         'mode -> SGAbstractShape.Mode.STROKE_FILL,
                                                         'fillPaint -> Color.RED,
                                                         'drawPaint -> Color.ORANGE,
                                                         'drawStroke -> new BasicStroke(5.0f)
                                                   )
                                               )
                                           ),
                                           scale("blah", 1.0, 1.0, 
                                               text("blah",
                                                    'text -> "Blah",
                                                    'location -> new Point(10,20)
                                               )
                                           ),
                                           translate("button", 10, 110,
                                               composite("button", 0.75, 
                                                  button('text->"FooBar")
                                               )
											)
                                       )
                         ),
                         'background -> Color.GREEN
                     ) -> "Center"
                 )
    )
    val rotateClip = Clip.create(
            500,
            600f,
            rotate.id("square"), 
            "rotation", 
            Array(-3.14159f, 3.14159f).map(_.asInstanceOf[Object]).elements
    )
    rotateClip.start()
/*   
    Clip.create(
            510, 
            600f,
            translate.id("button"), 
            "translateY",
            Array(50f, 150f).map(_.asInstanceOf[Object]) 
    ).start()
    
    Clip.create(
            520, 
            600f,
            scale.id("blah"), 
            "scaleY",
            Array(0.5f, 5.0f).map(_.asInstanceOf[Object]) 
    ).start()
    Clip.create(
            480, 
            600f,
            composite.id("button"), 
            "opacity",
            Array(0.1f, 1.0f).map(_.asInstanceOf[Object]) 
    ).start()
*/
}
